package com.qmhl.toolposition.activity

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.webkit.WebResourceRequest
import android.webkit.WebView
import android.webkit.WebViewClient
import com.qmhl.toolposition.base.BaseActivity
import com.qmhl.toolposition.databinding.ActivityFeedbackBinding
import com.qmhl.toolposition.databinding.ActivityPositionHelperWebviewBinding


class PositionHelpWebViewActivity : BaseActivity() {

    private lateinit var binding: ActivityPositionHelperWebviewBinding
    lateinit var webView: WebView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityPositionHelperWebviewBinding.inflate(layoutInflater)
        setContentView(binding.root)
    }

    override fun initData() {
        super.initData()

        webView = binding.webview

        // 设置WebView的属性
        // 设置WebView的属性
        val webSettings = webView.settings
        webSettings.javaScriptEnabled = true // 启用JavaScript支持


        // 加载本地HTML文件
        intent.getStringExtra("url")?.let { webView.loadUrl(it) };
        intent.getStringExtra("title")?.let { binding.tvTitle.text = it }

        webView.setWebViewClient(object : WebViewClient() {
            override fun shouldOverrideUrlLoading(
                view: WebView?, request: WebResourceRequest?
            ): Boolean {
                return super.shouldOverrideUrlLoading(view, request)
            }
        })

    }


    override fun initListener() {
        super.initListener()

        binding.ivBack.setOnClickListener {
            finish()
        }

    }


}